package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.ModuleQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.ModuleDao;
import com.bbdjt.weixin.model.Module;
import com.bbdjt.weixin.service.ModuleService;

@Service("moduleService")
public class ModuleServiceImpl extends BaseServiceImpl<Module> implements ModuleService {
	
	@Override
    public List<Module> selectByModule(Module module, int page, int rows) {
        Example example = new Example(Module.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(module);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<Module> selectByModule(Module module) {
        Example example = new Example(Module.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(module);
        return selectByExample(example);
    }

    @Override
    public PageInfo<ModuleQueryModel> selectByModuleQueryModel(ModuleQueryModel module) {
    	return ((ModuleDao) getMapper()).selectByModuleModel(module);
    }

	@Override
	public List<Module> selectByModule(ModuleQueryModel module) {
		  Example example = new Example(Module.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(module);
	        PageHelper.startPage(module.getPageNum(), module.getPageSize(),module.getOrderBy());
	        return selectByExample(example);
	}

	
}